package com.ex.model;
// Generated 2018-7-14 23:34:36 by Hibernate Tools 4.3.5.Final

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * TClass generated by hbm2java
 */
@Entity
@Table(name = "t_class", catalog = "huaqiao", uniqueConstraints = @UniqueConstraint(columnNames = "master_teacher"))
public class TClass implements java.io.Serializable {

	private Integer id;
	private TMajor TMajor;
	private TTeacher TTeacher;
	private String name;
	private String code;
	private Date modifiedTime;
	private Integer modifiedBy;
	private String grade;
	private Set TStudents = new HashSet(0);

	public TClass() {
	}

	public TClass(String name, String code) {
		this.name = name;
		this.code = code;
	}

	public TClass(TMajor TMajor, TTeacher TTeacher, String name, String code, Date modifiedTime, Integer modifiedBy,
			String grade, Set TStudents) {
		this.TMajor = TMajor;
		this.TTeacher = TTeacher;
		this.name = name;
		this.code = code;
		this.modifiedTime = modifiedTime;
		this.modifiedBy = modifiedBy;
		this.grade = grade;
		this.TStudents = TStudents;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)

	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "major_id")
	public TMajor getTMajor() {
		return this.TMajor;
	}

	public void setTMajor(TMajor TMajor) {
		this.TMajor = TMajor;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "master_teacher", unique = true)
	public TTeacher getTTeacher() {
		return this.TTeacher;
	}

	public void setTTeacher(TTeacher TTeacher) {
		this.TTeacher = TTeacher;
	}

	@Column(name = "name", nullable = false, length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "code", nullable = false, length = 30)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modified_time", length = 19)
	public Date getModifiedTime() {
		return this.modifiedTime;
	}

	public void setModifiedTime(Date modifiedTime) {
		this.modifiedTime = modifiedTime;
	}

	@Column(name = "modified_by")
	public Integer getModifiedBy() {
		return this.modifiedBy;
	}

	public void setModifiedBy(Integer modifiedBy) {
		this.modifiedBy = modifiedBy;
	}

	@Column(name = "grade", length = 20)
	public String getGrade() {
		return this.grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	@OneToMany(targetEntity=TStudent.class,fetch = FetchType.LAZY, mappedBy = "TClass")
	public Set getTStudents() {
		return this.TStudents;
	}

	public void setTStudents(Set TStudents) {
		this.TStudents = TStudents;
	}

}
